import React, { forwardRef, useRef } from 'react'

const MXInput = forwardRef((props, ref) => {
  return <input ref={ref} type="text"/>
})

export default function ForwardRefDemo() {
  const inputRef = useRef()

  return (
    <div>
      <MXInput ref={inputRef}/>
      <button onClick={e => inputRef.current.focus()}>Focus</button>
    </div>
  )
}
